//
//  UIBarButtonItem+Extension.swift
//  HMWeibo007
//
//  Created by TTang on 15/7/4.
//  Copyright © 2015年 shanyu. All rights reserved.
//

import UIKit

extension UIBarButtonItem {

    
    convenience init(imageName: String,highlightImageName: String?){
        
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        // ?? 表示如果前面的内容为 nil，使用后面的内容
        let hName = highlightImageName ?? imageName + "_highlighted"
        btn.setImage(UIImage(named: hName), forState: UIControlState.Highlighted)
        btn.sizeToFit()
        
        self.init(customView:btn)
        
    }
}
